package com.gc.server.vo.down;


import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;


import java.math.BigDecimal;

import com.gc.server.entity.GoodsApplyEntity;
import com.gc.server.vo.GoodsApplyVo;

import com.gc.server.enums.GoodsApplyStatusEnum;

/**
 * 物料申请实体
 * 表名 goods_apply
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date ${datetime}
 */
@Data
public class GoodsApplyDown implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    //
    @ExcelProperty("")
    private Long id;

    //申请人ID
    @ExcelProperty("申请人ID")
    private Long userId;

    @ExcelProperty("申请人")
    private String name;

    //用途
    @ExcelProperty("用途")
    private String remark;

    //订单号
    @ExcelProperty("订单号")
    private String orderNo;

    //物流单号
    @ExcelProperty("物流单号")
    private String logNo;

    //申请时间
    @ExcelProperty("申请时间")
    private Date date;

    //总数
    @ExcelProperty("总数")
    private Integer amount;

    //总价
    @ExcelProperty("总价")
    private BigDecimal price;

    //ENUM-状态:"WAIT-待审核","PASS-通过","REFUSE-拒绝"
    @ExcelIgnore
    private Integer status;
    @ExcelProperty("状态")
    private String statusStr;

    //操作人ID
    @ExcelProperty("操作人ID")
    private Long adminId;

    //操作人名称
    @ExcelProperty("操作人名称")
    private String adminName;

    //地址
    @ExcelProperty("地址")
    private String address;

    //使用单位
    @ExcelProperty("使用单位")
    private String unit;

    @ExcelProperty("产品")
    private String goodsName;


    public GoodsApplyDown() {

    }

    public GoodsApplyDown(GoodsApplyVo vo) {
        GoodsApplyEntity entity = vo.getEntity();
        this.setId(entity.getId());
        this.setName(vo.getUser().getName());
        this.setUserId(entity.getUserId());

        this.setRemark(entity.getRemark());

        this.setOrderNo(entity.getOrderNo());

        this.setLogNo(entity.getLogNo());

        this.setDate(entity.getDate());

        this.setAmount(entity.getAmount());

        this.setPrice(entity.getPrice());

        this.setStatus(entity.getStatus());
        if (entity.getStatus() != null) {
            this.setStatusStr(GoodsApplyStatusEnum.indexOf(entity.getStatus()));
        }

        this.setAdminId(entity.getAdminId());

        this.setAdminName(entity.getAdminName());

        this.setAddress(entity.getAddress());

        this.setUnit(entity.getUnit());

    }


}
